<?php
// Kiểm tra và update comment lên database
loadHelper('database');
include 'model.php';
if(isset($_POST['submit']))
{
        if(trim($_POST['comment'])!= '')
        {			
                include_once 'model.php';
                extract($_POST);
                if(insertComment($userid, $entryid, $comment) === 1)
                {
                    $comment = getLastCommentByUser($userid, $entryid);
                    include 'view_item.php';
                }
        }
}

if(isset($_GET['subaction']))
{
    echo $_GET['subaction']($_GET['id']);
}

if(isset($_GET['view']))
{
    switch($_GET['view'])
    {
        case 'item':
            $comment = getComment($_GET['id']);
            include 'view_item.php';
            break;
        default:
            break;
    }
}
?>
